<template>
  <div class="container">
    <div :class="['text', isRed ? 'red' : '']" @click="changeColor">
      This is About!
    </div>
    <!-- 按钮 -->
    <div class="btn">
      <el-button type="primary" @click="add1(1)">clicked {{ $store.state.times }} times</el-button>
    </div>
    <!-- 二级内容 -->
    <div class="item">
      <ul class="tip">
        <li>
          <RouterLink to="/about/detail/1">yangzhu</RouterLink>
        </li>
        <li>
          <RouterLink to="/about/detail/2">zhangsan</RouterLink>
        </li>
        <li>
          <RouterLink to="/about/detail/3">lisi</RouterLink>
        </li>
      </ul>
      <div class="detail">
        <RouterView />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'AboutView',
  data () {
    return {
      isRed: false
    }
  },
  methods: {
    // 点击修改标题颜色
    changeColor () {
      this.isRed = !this.isRed
    },
    // 次数加一
    add1 (num) {
      this.$store.commit('changeTimes', num)
    }
  }
}

</script>

<style lang="less" scoped>
.container {
  .text {
    height: 100px;
    text-align: center;
    line-height: 100px;
    font-size: 32px;
    font-weight: bold;
    color: #666;
    border-bottom: 1px solid #666;
    cursor: pointer;
  }
  .red {
    color: red;
  }

  .btn {
    text-align: center;
    margin-top: 10px;
  }

  .item {
    .tip {
      height: 30px;
      clear: both;
      margin-top: 10px;
      display: flex;
      justify-content: center;

      li {
        float: left;
        width: 120px;
        text-align: center;
        line-height: 30px;
        border-top: 1px solid #999;
        border-right: 1px solid #999;
        border-left: 1px solid #999;
      }
    }
  }
}
</style>
